var scriptUrl;
<% if (_script_type == "module") { %>
if (typeof <%- _import_meta_name %>.url === "string") scriptUrl = <%- _import_meta_name %>.url
<% } else { %>
if (<%- GLOBAL %>.importScripts) scriptUrl = <%- GLOBAL %>.location + "";
var document = <%- GLOBAL %>.document;
if (!scriptUrl && document) {
  // Technically we could use `document.currentScript instanceof window.HTMLScriptElement`,
  // but an attacker could try to inject `<script>HTMLScriptElement = HTMLImageElement</script>`
  // and use `<img name="currentScript" src="https://attacker.controlled.server/"></img>`
  if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') scriptUrl = document.currentScript.src;
  if (!scriptUrl) {
    var scripts = document.getElementsByTagName("script");
    if (scripts.length) {
      var i = scripts.length - 1;
      while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
    }
  }
}
<% } %>
// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration",
// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.',
if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
<% if (_undo_path == "") { %>
<%- PUBLIC_PATH %> = scriptUrl;
<% } else { %>
<%- PUBLIC_PATH %> = scriptUrl + '<%- _undo_path %>';
<% } %>